#pragma once

#include <iostream>
#include <vector>
#include <ctime>
typedef void (*task_t)();
void Register()
{
    std::cout << "执行注册任务" << std::endl;
}
void DownLoad()
{
    std::cout << "执行下载任务" << std::endl;
}
void LoadData()
{
    std::cout << "执行加载任务" << std::endl;
}
class TaskManager
{
public:
    TaskManager()
    {
        srand(0);
    }
    void Insert(task_t task)
    {
        _tasks.push_back(task);
    }
    void Execute(int code)
    {
        if (code >= 0 && code < _tasks.size())
            _tasks[code]();
    }
    int Code()
    {
        return rand() % _tasks.size();
    }
    ~TaskManager()
    {
    }

private:
    std::vector<task_t> _tasks;
};